<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>call-apply-bind</title>
</head>
<body>
    <script>
        function add(a,b,c){
            console.log(this);
            console.log(a + b + c);
        }

        //1. 立即调用
        // add(1,2,3);
        //2. call 调用
        // add.call({}, 2, 3, 4);
        //3. apply 调用
        // add.apply({name: '哈喽 apply'}, [3,4,5]);

        //4. bind 方法  返回一个新的函数
        var obj = {name: '哈喽 bind'};
        var fn = add.bind(obj);
        fn(4,5,6);
        
    </script>
</body>
</html>